package com.heima.freemarker.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * @author itheima
 * @since 2022-07-04
 */
@Controller
public class HelloController {

    @GetMapping("/hello")
    public String hello(Model model) {
        model.addAttribute("name","itheima");

        Map<String,Object> map1 = new HashMap<>();
        map1.put("name","天天");
        map1.put("age",18);

        Map<String,Object> map2 = new HashMap<>();
        map2.put("name","弟弟");
        map2.put("age",12);

        List<Map> list = new ArrayList<>();
        list.add(map1);
        list.add(map2);
        model.addAttribute("stus",list);
        model.addAttribute("today", new Date());
        return "01-basic";
    }

}
